#! /bin/sh

name=zstd
version=1.5.7
revision=1
tarball_url="https://github.com/facebook/zstd/releases/download/v${version}/zstd-${version}.tar.gz"
tarball_blake2b="ef6bcf13bbb79edce2de21ef4860b01dcb4d2dd47ebd03657d5331c3bb1a207ef128e99ed907a32e787dca7bb51df225ebd8abb2097d03d02c003ca713e1e271"
imagedeps="cmake ninja-build"
hostdeps="gcc pkg-config"
deps="core-libs zlib xz lz4"

configure() {
        cmake_source_dir="$source_dir/build/cmake" \
    cmake_configure \
        -DZSTD_ZLIB_SUPPORT=ON \
        -DZSTD_LZMA_SUPPORT=ON \
        -DZSTD_LZ4_SUPPORT=ON \
        -DZSTD_BUILD_CONTRIB=OFF \
        -DZSTD_BUILD_STATIC=OFF \
        -DZSTD_BUILD_TESTS=OFF \
        -DZSTD_PROGRAMS_LINK_SHARED=ON
}

build() {
    ninja -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" ninja install

    post_package_strip
}
